package edu.java.lectures.lec03.design.patterns;

public class MySingleton {

    // declaring the only static instance of the class --> private modifier
    private static MySingleton ms=null;
    
    // declaring private constructor
    private MySingleton(){
	
    }
    
    // define public getter method to the only instance of the class
    public static MySingleton instance(){
	if(ms==null){
	    ms= new MySingleton();
	}
	return ms;
    }
    
    // declaring public methods to this singleton class
    public void testMe(){
	System.out.println("Hello, I'm here. I'll be the best Java new bie");
    }

}

class TestMySingleton{
    public static void main(String...strings ){
	MySingleton.instance().testMe();
    }
}
